//
//  PersonTableViewCell.m
//  CareLink
//
//  Created by 赵玉忠 on 16/8/22.
//  Copyright © 2016年 Seven Team. All rights reserved.
//

#import "PersonTableViewCell.h"
@interface PersonTableViewCell()

@end
@implementation PersonTableViewCell


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setup];
    }
    return self;
}

-(void)setup{
    
    UILabel *nameClassLabel = [[UILabel alloc]init];
    nameClassLabel.text = @"名字";
    self.nameClassLabel = nameClassLabel;
    [nameClassLabel sizeToFit];
    [self.contentView addSubview:nameClassLabel];
    [nameClassLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10);
        make.top.bottom.offset(0);
    }];
    
    UIImageView *imageViewRight = [[UIImageView alloc]init];
    [imageViewRight sizeToFit];
    imageViewRight.image = [UIImage imageNamed:@"link_content"];
    [self.contentView addSubview:imageViewRight];
    [imageViewRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-2);
        make.top.offset(15);
        make.bottom.offset(-15);
        make.width.offset(self.contentView.bounds.size.height - 30);
    }];
    
    UILabel *dataLabel = [[UILabel alloc]init];
    self.dataLabel = dataLabel;
    dataLabel.textAlignment = NSTextAlignmentRight;
    dataLabel.text = @"100";
    [dataLabel sizeToFit];
    [self.contentView addSubview:dataLabel];
    [dataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(imageViewRight.mas_left).offset(-5);
//        make.width.mas_offset(50);
        make.top.bottom.offset(0);
//        make.width.offset(30);
    }];

    
}
-(void)setModel:(PersonMassageModel *)model{
    _model = model;
    _dataLabel.text = model.data;
    _nameClassLabel.text = model.name;
}
@end
